import 'package:flutter/material.dart';

class CommonButton extends StatelessWidget {
  const CommonButton({
    super.key,
    this.text,
    this.width,
    this.height,
    this.radius,
    this.color,
    this.onPress
  });

  final String? text;
  final double? width;
  final double? height;
  final double? radius;
  final Color? color;

  final void Function()? onPress;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width ?? double.infinity,
      height: height,
      clipBehavior: Clip.antiAlias,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(radius ?? 10),
      ),
      child: ElevatedButton(
        onPressed: this.onPress,
        style: ButtonStyle(
          backgroundColor: WidgetStatePropertyAll(color ?? Colors.grey.shade100),
          elevation: WidgetStateProperty.all(0),
          minimumSize: WidgetStateProperty.all(Size.zero),
          shape: WidgetStateProperty.all(const RoundedRectangleBorder(
            borderRadius: BorderRadius.zero,
          ))
        ),
        child: Text(
          text ?? "",
          style: const TextStyle(
            fontSize: 17,
            fontWeight: FontWeight.w600,
            color: Colors.white,
          ),
        )
      ),
    );
  }
}

